package C009;

/**
 * ClassName: SingleReverse
 * Package: C007
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/11/29 11:38
 * @Version 1.0
 * @Since 1.0
 */
public class SingleReverse {
    static class Node {
        private int data;
        private Node next;
    }
    public static void main(String[] args) {

    }


    public static Node reverse(Node root) {
        Node next;
        Node pre = null;
        while(root != null) {
            next = root.next;
            root.next = pre;
            pre = root;
            root = next;
        }
        return pre;
    }
}
